import static org.junit.Assert.*;

import org.junit.Test;

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

/**
 * JUnit testing for LogEntry class
 * 
 */

/**
 * @author DAT
 *
 */
public class LogEntryTest {

	// black box testing
	// use case
	@Test
	public void testGetTimestampAsString() {
		DateTime test_now = DateTime.now();
		
		// constructing new LogEntry object
		LogEntry test_Entry = new LogEntry(test_now, "test_cmd", new TaskList());
		String actual = test_Entry.getTimestampAsString();
		
		DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss");
		String expected = test_now.toString(formatter);
		
		// assert if getTimestampAsString() works as expected
		assertEquals(expected, actual);
	}
	
	// black box testing
	// use case
	@Test
	public void testGetCmd() {
		DateTime test_now = DateTime.now();
		
		// constructing new LogEntry object
		LogEntry test_Entry = new LogEntry(test_now, "test_cmd", new TaskList());
		String actual = test_Entry.getCmd();
		
		String expected = "test_cmd";
		
		// assert if getCmd() works as expected
		assertEquals(expected, actual);
	}

	
}
